<?php


namespace app\admin\controller\setting;

use app\admin\controller\AdminController;
use app\admin\service\setting\AgreementService;
use app\admin\service\setting\WebSetService;
use think\response\Json;

class Agreement extends AdminController
{
    /**
     * 获取协议信息
     * @return Json
     */
    public function detail()
    {
        $params = $this->getData([
            ['type', 1],
        ]);
        $result = AgreementService::detail($params);
        return $this->data($result);
    }

    /**
     * 设置基础信息
     * @return Json
     */
    public function edit()
    {
        $params = $this->postData([
            ['type', 1],
            ['name', ''],
            ['content', ''],
        ]);
        $result = AgreementService::edit($params);
        if(true === $result) {
            return $this->success([], '设置成功');
        } else {
            return $this->error(WebSetService::getError());
        }
    }
}